extends layout.pug

block title
  title= 'Fragment'
  - var selected = 'images'

block content
    if message.length > 0
        p= ''
        p(class="alert alert-dismissible alert-danger")= message
        p= ''
    if info.length > 0
        p= ''
        p(class="alert alert-dismissible alert-info")= info
        p= ''
    h1= 'Hauptübersicht'
    p= 'Hier sind alle Bilder aufgelistet'
    table(class="table")
        thead
          tr
            th= 'Id'
            th= 'Pfad'
            th= 'Erstellungsdatum'
            th= 'Fragmente'
            th= 'Löschen'
        tbody
          each row in rows
            - ident_ = row[0]
            - base = Number(row[3] + row[4])
            - row_class = ''
            if base !== row[4]
                - row_class = 'warning'
            tr(class=row_class)
              td= row[0]
              td= row[1]
              td= new Date(Number(row[2])).toLocaleString()
              td
                a(href='/image/' + ident_ + '/fragments')= 'Fragmente ('+row[4]+'/'+base.toString()+' fertig)'
              td
                a(href='/image/' + ident_ + '/delete')= 'Löschen'
    h2= 'Upload'
    include upload.pug